import Vue from 'vue'
import Router from 'vue-router'
import Home from "../components/Home";
import Note from "../components/Note";
import Diary from "../components/Diary";
import Link from "../components/Link";
import Chat from "../components/Chat";
import About from "../components/About";
import BlogDetail from "../components/BlogDetail";
import AddBlog from "../components/AddBlog";

Vue.use(Router);

let VueRouterPush = Router.prototype.push;
Router.prototype.push = function push (to) {
  return VueRouterPush.call(this, to).catch(err => err)
};

export default new Router({
  routes: [
    {
      path: '/',
      name: 'Home',
      component: Home,
      children: [
        {name: 'Note', path:'/Note', component:Note},
        {name: 'Diary', path:'/Diary', component:Diary},
        {name: 'Link', path:'/Link', component:Link},
        {name: 'Chat', path:'/Chat', component:Chat},
        {name: 'About', path:'/About', component:About}
      ]
    },
    {
      path: '/BlogDetail',
      name: 'BlogDetail',
      component: BlogDetail,
    },
    {
      path: '/AddBlog',
      name: 'AddBlog',
      component: AddBlog,
    }
  ]
})
